let request={
    loginInit:function(params,success)
    {
        post("admin/v1/loginInit",params,function(data){
            success(data);
        });
    },
    login:function(params,success,error){
        $.ajax({
            url: "admin/v1/login",
            type: "GET",
            data: params,
            dataType:'json',
            timeout: 8000, // 设置超时时间为8秒
            success: function(data) {
                // 请求成功的回调函数
                if(data.code==0 && data.data!=undefined){

                    if(data.data.userType=='school' || data.data.userType=='teacher')
                    {
                        let keyWordSchoolId=data.data.schoolId;
                        let keyWordSchoolName=data.data.schoolName;
                        let keyWordSchoolType=data.data.schoolType;
                        if(keyWordSchoolId!=undefined && keyWordSchoolId!='undefined'){localStorage.setItem("keyWordSchoolId",keyWordSchoolId);}
                        if(keyWordSchoolName!=undefined && keyWordSchoolName!='undefined'){localStorage.setItem("keyWordSchoolName", keyWordSchoolName);}
                        if(keyWordSchoolType!=undefined && keyWordSchoolType!='undefined'){localStorage.setItem("keyWordSchoolType", keyWordSchoolType);}

                        let keyWordTaskId=data.data.taskId;
                        let keyWordTaskName=data.data.taskName;
                        if(keyWordTaskId!=undefined && keyWordTaskId!=0){
                            localStorage.setItem("keyWordTaskId",keyWordTaskId);
                            localStorage.setItem("keyWordTaskName",keyWordTaskName);
                        }else{
                            localStorage.removeItem("keyWordTaskId");
                            localStorage.removeItem("keyWordTaskName");
                        }
                    }
                    localStorage.setItem("a@m", encryptLocalStorage(data.data));
                }
                success(data);
            },
            error: function(err, textStatus, errorThrown) {
                console.log(JSON.stringify(err))
                // 请求失败的回调函数
                error(err);
            }
        });
    },
    token:function(params,success)
    {
        get("admin/v1/token",params,function(data){success(data);});
    },
    /**
     * 账号接口
     * @param params
     * @param success
     */
    page:function(moduleName,params,success){
        get("admin/v1/"+moduleName+"/page",params,function(data){success(data);});
    },
    list:function(moduleName,params,success){
        get("admin/v1/"+moduleName+"/list",params,function(data){success(data);});
    },
    view:function(moduleName,params,success){
        get("admin/v1/"+moduleName+"/detail",params,function(data){success(data);});
    },
	add:function(moduleName,params,success){
        post("admin/v1/"+moduleName+"/add",params,function(data){success(data);});
    },
    update:function(moduleName,params,success){
        post("admin/v1/"+moduleName+"/update",params,function(data){success(data);});
    },
    complete:function(moduleName,params,success){
        post("admin/v1/"+moduleName+"/complete",params,function(data){success(data);});
    },
    audit:function(moduleName,params,success){
        post("admin/v1/"+moduleName+"/audit",params,function(data){success(data);});
    },
    del:function(moduleName,params,success){
        get("admin/v1/"+moduleName+"/del",params,function(data){success(data);});
    },
	delList:function(moduleName,params,success){
		get("admin/v1/"+moduleName+"/delList",params,function(data){success(data);});
	},
	otherGetMethod:function(moduleName,method,params,success){
	    get("admin/v1/"+moduleName+"/"+method,params,function(data){success(data);});
	},
    otherPostMethod:function(moduleName,method,params,success){
        post("admin/v1/"+moduleName+"/"+method,params,function(data){success(data);});
    },
    provinceList:function(params,success){
        get("admin/v1/area/province",params,function(data){success(data);});
    },
    cityList:function(params,success){
        get("admin/v1/area/city",params,function(data){success(data);});
    },
    districtList:function(params,success){
        get("admin/v1/area/district",params,function(data){success(data);});
    },
    schoolList:function(params,success){
        get("admin/v1/school/list",params,function(data){success(data);});
    },
    sportList:function(params,success){
        get("admin/v1/sport/sportList",params,function(data){success(data);});
    }

}